/**
 * 会员中心
 */
var app = getApp()
Page({
	data: {
		root:app.setting.att_url,
		pagedata:[],
		action: '',
		pagetitle:'我的优惠券' + '-' + app.setting.title,
		bannerHeight: Math.ceil(290.0 / 750.0 * getApp().screenWidth)
	},
	onPullDownRefresh: function (){
		var the=this;
		var opt={};
		the.onLoad(opt);
		setTimeout(function(){
			wx.stopPullDownRefresh()
		},1000);
	},
	onLoad: function (options){
		var the = this;
		wx.setNavigationBarTitle({'title':the.data.pagetitle});
		app.util.get(app.access,function(pagedata){
			console.log(pagedata);
			the.setData({
				pagedata:pagedata,
				loading:false
			});
		});
	},
	set: function (e) {
		var data = e.currentTarget.dataset;
		app.util.post('tx',data);
	},
	addwxcard: function (e) {
		var data = e.currentTarget.dataset;
		wx.addCard({
			cardList: [
				{
				  cardId: data.card_id,
				  cardExt: data.cardExt
				},
			],
			success(res) {
				app.util.message('添加成功!');
			}
		})
	},
  	click:function(evt){
		//用户点击事件 data.func 为方法名，data.params 为调用参数！
		var data=evt.currentTarget.dataset;
		app.util[data.func](data.params);
	}
})